# Group Feedback
feedbacks related to the events.

| Parameter | Description | Type | Required |
|:----------|-------------|------|----------|
| `rating`  | Rating for the overall event | float | **yes** |
| `comment` | Comments and suggestions about the event | string | - |



## Feedback Collection [/v1/feedbacks{?page%5bsize%5d,page%5bnumber%5d,sort,filter}]
+ Parameters
    + page%5bsize%5d (optional, integer, `10`) - Maximum number of resources in a single paginated response.
    + page%5bnumber%5d (optional, integer, `1`) - Page number to fetched for the paginated response.
    + sort (optional, string, `rating`) - Sort the resources according to the given attribute in ascending order. Append '-' to sort in descending order.
    + filter (optional, string, `[]`) - Filter according to the flask-rest-jsonapi filtering system. Please refer: http://flask-rest-jsonapi.readthedocs.io/en/latest/iltering.html for more.

### Create Feedback [POST]
Create a new feedback with event_id.

+ Request (application/vnd.api+json)

    + Headers

            Authorization: JWT <Auth Key>

    + Body

            {
              "data": {
                "relationships": {
                  "session": {
                    "data": {
                      "type": "session",
                      "id": "1"
                    }
                  },
                  "user": {
                    "data": {
                      "type": "user",
                      "id": "1"
                    }
                  }
                },
                "attributes": {
                  "rating": 4,
                  "comment": "Awesome session."
                },
                "type": "feedback"
              }
            }


+ Response 201 (application/vnd.api+json)

        {
            "data": {
                "relationships": {
                    "session": {
                        "links": {
                            "self": "/v1/feedbacks/1/relationships/session",
                            "related": "/v1/feedbacks/1/event"
                        }
                    },
                    "user": {
                        "links": {
                            "self": "/v1/feedbacks/1/relationships/user",
                            "related": "/v1/feedbacks/1/user"
                        }
                    },
                    "event": {
                        "links": {
                            "self": "/v1/feedbacks/1/relationships/event",
                            "related": "/v1/feedbacks/1/event"
                        }
                    }
                },
                "attributes": {
                    "rating": 4.0,
                    "deleted-at": null,
                    "comment": "Awesome session."
                },
                "type": "feedback",
                "id": 1,
                "links": {
                    "self": "/v1/feedbacks/1"
                }
            },
            "jsonapi": {
                "version": "1.0"
            },
            "links": {
                "self": "/v1/feedbacks/1"
            }
        }


## Feedback Detail [/v1/feedbacks/{feedback_id}]
+ Parameters
    + feedback_id: 1 (integer) - ID of the feedback in the form of an integer

### Feedback Detail [GET]
Get a single feedback.

+ Request

    + Headers

            Accept: application/vnd.api+json

+ Response 200 (application/vnd.api+json)

        {
            "data": {
                "relationships": {
                    "event": {
                        "links": {
                            "self": "/v1/feedbacks/1/relationships/event",
                            "related": "/v1/feedbacks/1/event"
                        }
                    },
                    "user": {
                        "links": {
                            "self": "/v1/feedbacks/1/relationships/user",
                            "related": "/v1/feedbacks/1/user"
                        }
                    }
                },
                "attributes": {
                    "rating": "4",
                    "comment": "Awesome event"
                },
                "type": "feedback",
                "id": 1,
                "links": {
                    "self": "/v1/feedbacks/1"
                }
            },
            "jsonapi": {
                "version": "1.0"
            },
            "links": {
                "self": "/v1/feedbacks/1"
            }
        }


### Update Feedback [PATCH]
Update a single feedback with `id`.

+ `id` (integer) - ID of the record to update **(required)**

+ Request (application/vnd.api+json)

    + Headers

            Authorization: JWT <Auth Key>

    + Body

            {
              "data": {
                "type": "feedback",
                "attributes": {
                    "rating": "5",
                    "comment": "Awesome session"
                },
                "id": "1"
              }
            }


+ Response 200 (application/vnd.api+json)

        {
            "data": {
                "relationships": {
                    "event": {
                        "links": {
                            "self": "/v1/feedbacks/1/relationships/event",
                            "related": "/v1/feedbacks/1/event"
                        }
                    },
                    "user": {
                        "links": {
                            "self": "/v1/feedbacks/1/relationships/user",
                            "related": "/v1/feedbacks/1/user"
                        }
                    }
                },
                "attributes": {
                    "rating": "5",
                    "deleted-at": null,
                    "comment": "Awesome event"
                },
                "type": "feedback",
                "id": 1,
                "links": {
                    "self": "/v1/feedbacks/1"
                }
            },
            "jsonapi": {
                "version": "1.0"
            },
            "links": {
                "self": "/v1/feedbacks/1"
            }
        }

### Delete Feedback [DELETE]
Delete a single feedback.

+ Request

    + Headers

            Accept: application/vnd.api+json

            Authorization: JWT <Auth Key>

+ Response 200 (application/vnd.api+json)

        {
          "meta": {
            "message": "Object successfully deleted"
          },
          "jsonapi": {
            "version": "1.0"
          }
        }


## Event Feedback Collection [/v1/events/{event_identifier}/feedbacks{?page%5bsize%5d,page%5bnumber%5d,sort,filter}]
+ Parameters
    + event_identifier: 1 (string) - identifier or event id of the event. (b8324ae2 is an example of identifier)
    + page%5bsize%5d (optional, integer, `10`) - Maximum number of resources in a single paginated response.
    + page%5bnumber%5d (optional, integer, `1`) - Page number to fetched for the paginated response.
    + sort (optional, string, `rating`) - Sort the resources according to the given attribute in ascending order. Append '-' to sort in descending order.
    + filter (optional, string, `[]`) - Filter according to the flask-rest-jsonapi filtering system. Please refer: http://flask-rest-jsonapi.readthedocs.io/en/latest/iltering.html for more.

### List All Feedbacks for an Event [GET]
Get a list of feedbacks for an event.

+ Request

    + Headers

            Accept: application/vnd.api+json

            Authorization: JWT <Auth Key>


+ Response 200 (application/vnd.api+json)


        {
            "meta": {
                "count": 1
            },
            "data": [
                {
                    "relationships": {
                        "event": {
                            "links": {
                                "self": "/v1/feedbacks/1/relationships/event",
                                "related": "/v1/feedbacks/1/event"
                            }
                        },
                        "user": {
                            "links": {
                                "self": "/v1/feedbacks/1/relationships/user",
                                "related": "/v1/feedbacks/1/user"
                            }
                        }
                    },
                    "attributes": {
                        "rating": "4",
                        "deleted-at": null,
                        "comment": "Awesome event"
                    },
                    "type": "feedback",
                    "id": 1,
                    "links": {
                        "self": "/v1/feedbacks/1"
                    }
                }
            ],
            "jsonapi": {
                "version": "1.0"
            },
            "links": {
                "self": "/v1/events/1/feedbacks"
            }
        }
